import {Component, inject} from '@angular/core';
import {AuthService} from '../../services/auth.service';
import {Router} from '@angular/router';
import {NzMessageService} from 'ng-zorro-antd/message';

@Component({
  selector: 'app-header',
  standalone: false,
  templateUrl: './header.component.html',
  styleUrl: './header.component.less'
})
export class HeaderComponent {
  private authService = inject(AuthService);
  private router = inject(Router);
  private message = inject(NzMessageService);
  // 登出
  logout(): void {
    this.authService.logout();
    this.message.success('已成功退出登录');
    this.router.navigate(['/login']);
  }
}
